/* 
类类型: 实现接口
1. 一个类可以实现多个接口
2. 一个接口可以继承多个接口

*/
(function () {
  interface Alarm {
    alert(): void
  }
  interface Light {
    lightOn (): string
    ligntOff (): string
  }

  class Car implements Alarm, Light {
    alert(): void {
      console.log('alert()')
    }

    lightOn (): string {
      console.log('lightOn()')
      return '开灯'
    }
    ligntOff (): string {
      console.log('lightOff')
      return '关灯'
    }
  }

  const c = new Car()
  c.alert()
  c.lightOn()
  c.ligntOff()

  interface AlartLight extends Alarm, Light {

  }

  class Car2 implements AlartLight {
    alert(): void {
      console.log('alert2()')
    }

    lightOn (): string {
      console.log('lightOn2()')
      return '开灯'
    }
    ligntOff (): string {
      console.log('lightOff2()')
      return '关灯'
    }
  }

})()